<template>
    <div class="rostrum">
        <search-box class="search-view"/>
        <swiper :options="swiperOptions" :auto="2000" :height="165"/>
        <!-- <ul class="list">
            <li class="list-item" v-for="(item, key) in dataList" :key="key" v-on:click="handleItemClick(item.id)">
                <div class="top">{{item.title}}</div>
                <div class="bottom">
                    <div class="left"><img src="../../assets/expert1.png" /></div>
                    <div class="right">
                        <div class="center mb12"><img src="../../assets/list-lecturer.svg">{{item.name}}</div>
                        <div class="center"><img src="../../assets/list-time.svg">{{item.date}}</div>
                        <div class="last">
                            <div class="center"><img src="../../assets/list-locate.svg">{{item.address}}</div>
                            <div class="btn"><img src="../../assets/list-success.svg"><span>{{item.state}}</span></div>
                        </div>
                    </div>
                </div>
            </li>
        </ul> -->
        <think-list :list="dataList" type="4" @onclick="handleItemClick"/>
    </div>
</template>
<style lang="less" scoped>
    @import '../../style/variable';
    .rostrum {
        .list {
            background-color: @color-white;
            padding-left: 1.5rem;
            &-item {
                border-bottom: 1px solid rgba(0,0,0,.1);
                padding: 1rem 0.7rem 1.9rem 0;
                display: flex;
                flex-direction: column;
                .top{
                    color: #333E48;
                    font-size: 1.5rem;
                    font-weight: 500;
                    margin-bottom: 1.3rem;
                }
                .bottom{
                    display: flex;
                    align-items: center;
                    .left {
                        width: 6.9rem;
                        height: 6.9rem;
                        margin-right: 1.1rem;
                        img {
                            height: 100%;
                        }
                    }
                    .right{
                        width: 100%;
                        display: flex;
                        flex-direction: column;
                        justify-content: center;
                        font-size: 1.3rem;
                        img {
                            height: 1.4rem;
                            margin-right: 0.7rem;
                        }
                        .last {
                            width: 100%;
                            display: flex;
                            justify-content: space-between;
                            align-items: flex-end;
                            .btn {
                                display: flex;
                                align-items: center;
                                padding: 0.6rem;
                                border: 1px solid #949494;
                                border-radius: 0.3rem;
                                color: #7A7A7A;
                                img{
                                    margin-right: 0.5rem;
                                }
                            }
                        }
                        .center{
                            display: flex;
                            align-items: center;
                        }
                        .mb12 {
                            margin-bottom: 1.2rem;
                        }
                    }
                }
            }
        }
    }
</style>
<script>
    import { Swipe, SwipeItem } from 'vant';
    import { think as API } from 'api';
    import T from 'utils/T';
    export default {
        components: {
            [Swipe.name]: Swipe,
            [SwipeItem.name]: SwipeItem,
        },
        data() {
            return {
                swiperOptions: [
                    {
                        src: 'https://img.yzcdn.cn/public_files/2017/10/24/e5a5a02309a41f9f5def56684808d9ae.jpeg',
                        to: '/same'
                    },
                    'https://img.yzcdn.cn/public_files/2017/10/24/1791ba14088f9c2be8c610d0a6cc0f93.jpeg'
                ],
                dataList: [
                    {
                        title: '第45讲：金融风险集聚与金融去杠杆',
                        name: '齐精智律师（陕西明乐律师事务所高…',
                        address: '微信群语音直播',
                        date: '2018.12.14-2018.12.16',
                        state: '报名中'
                    },
                    {
                        title: '第44讲：从结构数据观察经济新动能发展态势',
                        name: '齐精智律师（陕西明乐律师事务所高…',
                        address: '微信群语音直播',
                        date: '2018.12.14-2018.12.16',
                        state: '录音课件已上传'
                    },
                    {
                        title: '第43讲：金融风险集聚与金融去杠杆',
                        name: '齐精智律师（陕西明乐律师事务所高…',
                        address: '微信群语音直播',
                        date: '2018.12.14-2018.12.16',
                        state: '录音课件已上传'
                    },
                    {
                        title: '第43讲：金融风险集聚与金融去杠杆',
                        name: '齐精智律师（陕西明乐律师事务所高…',
                        address: '微信群语音直播',
                        date: '2018.12.14-2018.12.16',
                        state: '录音课件已上传'
                    },
                ]
            }
        },
        created(){
            this.requestData();
        },
        methods: {
            handleItemClick(id) {
                this.$router.push({
                    path: '/think/rostrumDetail',
                    query: { id }
                });
            },
            requestData(){
                let params = {
                    type: 4
                };
                this.$axios.get(API.THINK_TANK, { params }).then((result)=>{
                    let resultData = result.data.list;
                    // this.dataList = resultData.map((item, key) => {
                    //     return {
                    //         id: item.id,
                    //         title: item.annTitle || '无数据',
                    //         name: item.author || '无数据',
                    //         address: item.holdLocation || '无数据',
                    //         date: `${T.formatDate(item.holdTime)}-${T.formatDate(item.holdTimeEnd)}`,
                    //         state: '报名中',
                    //         logoImg: item.picPath,
                    //     }
                    // });
                    console.log('resultData', resultData);
                })
            },
        }
    }
</script>